﻿using CTBU.DAO;
using CTBU.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Student.Areas.WebAPI.Controllers
{
    public class SysCommonController : Controller
    {
        private StudentDAO _stuDao = new StudentDAO();


        public JsonResult validateUser(string userName, string password)
        {

            IList<TbStudent> myCount = _stuDao.GetByWhere("SName=" + userName + "&SPassword=" + password);
            if (myCount.Count > 0)
            {

                Session["UserID"] = myCount[0].Id;

                return Json(new { ID = 1, Msg = "Success!" });
            }
            else
            {
                return Json(new { ID = -1, Msg = "找不到用户!" }, JsonRequestBehavior.AllowGet);
            }


        }
    }
}
